package com.dreamlin.network;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

public class TokenInterceptor implements Interceptor {
    @Override
    public Response intercept(Chain chain) throws IOException {
        //统一添加userId 及 token
        Request.Builder builder = chain.request().newBuilder();
        Request request = builder.header("userId", RetrofitHelper.getInstance().userId)
                .header("token", RetrofitHelper.getInstance().token).build();
        return chain.proceed(request);
    }
}
